package com.dhcy.mqtt.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dhcy.mqtt.dao.DeviceTypeMapper;
import com.dhcy.mqtt.model.DeviceType;
import com.dhcy.mqtt.par.ht.DeviceTypeAddPar;
import com.dhcy.mqtt.service.DeviceTypeService;
import com.dhcy.mqtt.util.AppResultData;
import com.dhcy.mqtt.util.IsNull;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 *@Description
 *@Author jzq
 *@Version V1.0
 **/
@Service
public class DeviceTypeServiceImpl extends ServiceImpl<DeviceTypeMapper, DeviceType> implements DeviceTypeService {
    @Autowired
    DeviceTypeMapper deviceTypeMapper;

    @Override
    public AppResultData deviceTypeAdd(DeviceType deviceType) {
        if (IsNull.isNullOrEmpty(deviceType.getId())) {
            deviceTypeMapper.insert(deviceType);
        } else {
            deviceTypeMapper.updateById(deviceType);
        }
        return AppResultData.successMessage("成功");
    }
}
